<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <h3>v-model修饰符.trim .number</h3>
        <!--
            按键修饰符：
            键盘事件可用
            @keyup.修饰符
            @keydown

            .enter表示用户按下了回车键
            .esc表示用户按下了esc键
        -->
        姓名：<input @keyup.enter="login" v-model.trim="username" type="text"><br>
        年纪：<input @keyup.enter="login" v-model.number="age" type="text"><br>
        
        <h3>@事件名.stop -> 阻止冒泡</h3>
        <div class="father" @click="fatherFn">
            <div class="son" @click.stop="sonFn">儿子</div>
        </div>

        <h3>@事件名.prevent -> 阻止默认行为</h3>
        <a @click.prevent href="https://www.baidu.com/">阻止默认行为</a>

    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.16/dist/vue.js"></script>
    <script>
        const app = new Vue({
            el:'#app',
            data:{
                username:'',
                age:''
            },
            methods:{
                fatherFn(){
                    alert('老父亲被点击了')
                },
                sonFn(){
                    //e.stopPropagation()
                    alert('儿子被点击了')
                }

            }
        })
    </script>
</body>
</html>